package  de.tum.softwarengineering1.ws201112.team11.sudoku.event;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import de.tum.in.softwareengineering1.ws201112.team11.gameframework.exception.GameException;
import de.tum.in.softwareengineering1.ws201112.team11.gameframework.model.IGame;
import de.tum.softwarengineering1.ws201112.team11.sudoku.model.Cell;

public class SudokuBoardChangeEvent implements IGame {
    private boolean completeRefresh;
    private List<Cell> changedCells;

    /**
     * Creates a new change event. Using this constructor signals a global
     * change.
     */
    public SudokuBoardChangeEvent() {
		changedCells = new ArrayList<Cell>();
		completeRefresh = true;
    }

    /**
     * Creates a new change event. Convenience constructor taking cells
     * 
     * @param changedCells
     */
    public SudokuBoardChangeEvent(Cell... changedCells) {
	if (changedCells == null || changedCells.length == 0) {
	    throw new IllegalArgumentException(
		    "List of changed cells may not be null or empty. Request a complete refresh if required!");
	} else {
	    this.completeRefresh = false;
	    this.changedCells = Arrays.asList(changedCells);
	}
    }

    /**
     * Creates a new change event. Signals that only the given cells have
     * changed.
     * 
     * @param changedCells
     */
    public SudokuBoardChangeEvent(List<Cell> changedCells) {
	if (changedCells == null || changedCells.isEmpty()) {
	    throw new IllegalArgumentException(
		    "List of changed cells may not be null or empty. Request a complete refresh if required!");
	} else {
	    this.completeRefresh = false;
	    this.changedCells = changedCells;
	}
    }

    public List<Cell> getChangedCells() {
	return changedCells;
    }

    public boolean isCompleteRefreshRequired() {
	return completeRefresh;
    }

	@Override
	public Boolean startGame() throws GameException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Boolean pauseGame() throws GameException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Boolean endGame() throws GameException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Boolean showOptions() throws GameException {
		// TODO Auto-generated method stub
		return null;
	}
}
